import request from '@/utils/request'

// 查询配方管理列表
export function list(query) {
    return request({
      url: '/api/ingredient/report/list',
      method: 'get',
      params: query
    })
  }

// 搜索ingredient列表
export function listIngredient(query) {
    return request({
      url: '/api/ingredient/list',
      method: 'get',
      params: query
    })
  }

// 搜索screen 列表
export function listScreen(query) {
    return request({
      url: '/api/ingredient/reportScreen/list',
      method: 'get',
      params: query
    })
  }

// 新增ingredient数据
export function add(data) {
    return request({
      url: '/api/ingredient',
      method: 'post',
      data: data
    })
  }

// 修改ingredient数据
export function edit(data) {
    return request({
      url: '/api/ingredient',
      method: 'put',
      data: data
    })
  }

// 删除ingredient数据
export function del(data) {
    return request({
      url: '/api/ingredient',
      method: 'delete',
      data: data
    })
  }

// 新增Report
export function addReport(safetyIngredientId,data) {
    return request({
      url: '/api/ingredient/'+ safetyIngredientId +'/report',
      method: 'post',
      data: data
    })
  }

// addScreen
export function addScreen(safetyIngredientId,data) {
    return request({
      url: '/api/ingredient/'+ safetyIngredientId +'/reportScreen',
      method: 'post',
      data: data
    })
  }

// updateReportDecisionRead
export function updateReportDecisionRead(zyno,reportid,data) {
    return request({
      url: '/api/ingredient/'+zyno+'/reportDecisionRead/'+ reportid ,
      method: 'post',
      data: data
    })
  }

//editReport
export function editReport(data) {
    return request({
      url: '/api/report',
      method: 'put',
      data: data
    })
  }

//editScreen
export function editScreen(data) {
    return request({
      url: '/api/reportScreen',
      method: 'put',
      data: data
    })
  }

// delReport
export function delReport(data) {
    return request({
      url: '/api/report',
      method: 'delete',
      data: data
    })
  }

// delScreen
export function delScreen(data) {
    return request({
      url: '/api/reportScreen',
      method: 'delete',
      data: data
    })
  }

export function getIngredientInfoById(id) {
    return request({
      url: '/api/ingredient?id=' + id,
      method: 'get',
    })
  }

// 导入Ingredient
export function importReport(data) {
  return request({
    url: '/api/importReport',
    method: 'post',
    data: data
  })
}